<?
namespace app\web\wap;

use app\web\dao\NavDao;
use app\web\dao\KeywordDao;
use app\web\dao\LinkDao;

class Base extends \xto\template\BaseController 
{  
	protected $nav;

	public function _initialize(){
		parent::_initialize(); 
		$ndao=NavDao::instance();
		$ndao->setorder('nav_order','asc');
		$this->assign('navs',$ndao->select());
		$this->assign('theme',$this->theme);
		if(!empty(input('nid'))){
			$ndao=NavDao::instance();
			$this->nav=$ndao->find(input('nid'));
			$this->assign('nav',$this->nav);
		} 
	}

	public function fetch($template = '', $vars = [], $replace = [], $config = []){
		$replace=array_merge($replace,['/res'=>'/app/web/view/wap/'.$this->theme.'/res']);
		$template=$this->theme.DS.(empty($template)?$this->c.DS.$this->a:$template);
		return parent::fetch($template,$vars,$replace,$config);
	}

	public function getTheme(){
		return 'default';
	}

	//框架内容
	public function getlayout(){
        return APP_PATH."web/view/wap/$this->theme/layout.html";  
    }
}